package com.group2.view;

import java.awt.event.*;
import java.io.*;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Vector;

import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.JPanel;

//import com.group2.dao.CourseDao;
import model.Course;
import model.MyCourseTime;
import com.group2.util.StringUtil;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.GroupLayout;
import model.*;
import static model.netBase.IP;





/*选课系统模块：
 * 管理员增加、删除、查询课程信息（右键方式、按钮方式）
 * */

public class CourseMainViewFrame_Admin extends javax.swing.JFrame{

	private JPopupMenu menu;
	private JTable courseTable;
	private JScrollPane jScrollPane1;
	private JPanel contentPane;
	
	private JTextField capacityTxt;
	private JTextField courseIdTxt;
	private JTextField courseNameTxt;
	private JTextField courseTeacherTxt;
	private JTextField courseTimeTxt;
	private JTextField courseLocationTxt;
	private JTextField numSelectedTxt;
	private JTextField s_courseNameTxt;
	private JTextField s_courseTeacherTxt;
	private JTextField s_courseLocationTxt;
	
	private JLabel jLabel1;
	private JLabel jLabel2;
	private JLabel jLabel3;
	private JLabel jLabel4;
	private JLabel jLabel5;
	private JLabel jLabel6;
	private JLabel jLabel7;
	private JLabel jLabel8;
	private JLabel jLabel9;
	private JPanel jPanel1;
	private JPanel jPanel2;

	private JButton jb_add;
	private JButton jb_delete;
	private JButton jb_modify;
	private JButton jb_search;
	private JMenuItem jm_add,jm_delete, jm_search, jm_modify;
	private static ArrayList<Course>list=null;
	private static int row=0;
	private int NumSelected;
	
	public CourseMainViewFrame_Admin() throws IOException, ClassNotFoundException {
		initComponents();
		this.setLocationRelativeTo(null);
		this.setVisible(true);
		//menu.setVisible(true);
		getContentPane().add(menu);
		reFresh();
		this.fillTable(list);

	}
	private void reFresh() throws IOException, ClassNotFoundException {
		System.out.println("开始传输");
		//拉取选课队列
		Socket socket = new Socket(IP(), 2000);//此处主机地址请自行修改
		//设置超时时间
		socket.setSoTimeout(3000);
		//构建IO
		OutputStream os = socket.getOutputStream();
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
		bw.write("44" +'\n');
		bw.flush();
		//从服务端输入到本地
		InputStream is = socket.getInputStream();
		ObjectInputStream in = new ObjectInputStream(is);
		Object obj = in.readObject();
		System.out.println("传输结束");
		list = (ArrayList<model.Course>) obj;
		System.out.println(list.get(0).getCourseName());
		//输出输入流关闭
		is.close();
		os.close();
		socket.close();
	}
	private void fillTable(ArrayList<Course> course) {
		DefaultTableModel dtm = (DefaultTableModel) courseTable.getModel();
		dtm.setRowCount(0);
		try {
			int size = course.size();
			int index = 0;
			while (size > 0) {
				Vector v = new Vector();
				v.add(course.get(index).getCourseId()) ;v.add(course.get(index).getCourseName());v.add(course.get(index).getCourseTime().toString());v.add(course.get(index).getCourseLocation());v.add(course.get(index).getCourseTeacher());v.add(course.get(index).getCourseCapacity());v.add((course.get(index).getCourseCapacity() - course.get(index).getCourseRemainingCapacity()));
				dtm.addRow(v);
				size--;
				index++;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}


	private void initComponents() {
		
		jScrollPane1 = new JScrollPane();
		courseTable = new JTable();
		jb_delete=new JButton("删除");
		jb_modify=new JButton("修改");
		jb_add=new JButton("添加");
		jb_search=new JButton("查询");
		jm_delete=new JMenuItem("删除");
		jm_modify=new JMenuItem("修改");
		jm_add=new JMenuItem("添加");
		
		capacityTxt=new JTextField();
		courseIdTxt=new JTextField();
		courseNameTxt=new JTextField();
		courseTeacherTxt=new JTextField();
		courseTimeTxt=new JTextField();
		courseLocationTxt=new JTextField();
		numSelectedTxt=new JTextField();
		numSelectedTxt.setEditable(false);
		s_courseNameTxt=new JTextField();
		s_courseTeacherTxt=new JTextField();
		s_courseLocationTxt=new JTextField();
		
		//搜索标签
		jLabel1=new JLabel("课程名称：");
		jLabel2=new JLabel("上课时间：");
		jLabel3=new JLabel("任课老师：");
		//其他标签
		jLabel4=new JLabel("课程编号：");
		jLabel5=new JLabel("课程名称：");
		jLabel6=new JLabel("上课时间：");
		jLabel7=new JLabel("任课老师：");
		jLabel8=new JLabel("课程容量：");
		jLabel9=new JLabel("已选人数：");
		
		/*contentPane=new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		contentPane.setBounds(100,500 , 400, 200);*/
		
		 menu= new JPopupMenu();
		 menu.add(jm_add);
		 menu.add(jm_delete);
		 menu.add(jm_modify);
		 
		setTitle("课程管理系统 -  Course Manage System for Admin");
		
		courseTable.setModel(new javax.swing.table.DefaultTableModel
				(new Object[][] {}, new String[] {
						"课程编号", "课程名称", "上课时间", "上课地点","任课老师", "课程容量", "选课人数"}) 
		{boolean[] canEdit = new boolean[] {
				false, false, false, false,false, false, false };

			public boolean isCellEditable(int rowIndex, int columnIndex) 
			{
				return canEdit[columnIndex];
			}
			
		});
		//选中表格行
		courseTable.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mousePressed(java.awt.event.MouseEvent evt) {
				courseTableMousePressed(evt);
			}
		});
		
		jScrollPane1.setViewportView(courseTable);

		jPanel1=new JPanel();
		jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("查询条件"));
		jPanel2=new JPanel();
		jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("表项操作"));
		

		jb_search.setIcon(new javax.swing.ImageIcon(UserLogOnFrame.class.getResource("/images/search.png")));
		jb_search.setText("查询");
		jb_search.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				try {
					SearchActionPerformed(evt);
				} catch (IOException e) {
					throw new RuntimeException(e);
				} catch (ClassNotFoundException e) {
					throw new RuntimeException(e);
				}
			}
		});
		
		jb_modify.setIcon(new javax.swing.ImageIcon(UserLogOnFrame.class.getResource("/images/modify.png")));
		jb_modify.setText("修改");
		jb_modify.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				try {
					ModifyActionPerformed(evt);
				} catch (IOException e) {
					throw new RuntimeException(e);
				} catch (ClassNotFoundException e) {
					throw new RuntimeException(e);
				}
			}
		});

		jb_delete.setIcon(new javax.swing.ImageIcon(UserLogOnFrame.class.getResource("/images/delete.png")));
		jb_delete.setText("删除");
		jb_delete.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				DeleteActionPerformed(evt);
			}
		});
		
		//jb_add.setBounds(20,100,80,30);添加
		jb_add.setIcon(new javax.swing.ImageIcon(UserLogOnFrame.class.getResource("/images/add.png")));
		jb_add.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				try {
					AddActionPerformed(evt);
				} catch (IOException e) {
					throw new RuntimeException(e);
				} catch (ClassNotFoundException e) {
					throw new RuntimeException(e);
				}
			}
		});
		
		javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
		jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addGap(32).addComponent(jLabel1).addPreferredGap(ComponentPlacement.RELATED).addComponent(s_courseNameTxt, GroupLayout.PREFERRED_SIZE, 158, GroupLayout.PREFERRED_SIZE).addGap(42).addComponent(jLabel3).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(s_courseLocationTxt, GroupLayout.PREFERRED_SIZE, 149, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED, 53, Short.MAX_VALUE).addComponent(jLabel2).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(s_courseTeacherTxt, GroupLayout.PREFERRED_SIZE, 151, GroupLayout.PREFERRED_SIZE).addGap(53).addComponent(jb_search).addGap(34)));
		jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addGap(18).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(s_courseNameTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel1).addComponent(s_courseLocationTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel3).addComponent(s_courseTeacherTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel2).addComponent(jb_search)).addContainerGap(43, Short.MAX_VALUE)));
		jPanel1.setLayout(jPanel1Layout);
		javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
		jPanel2.setLayout(jPanel2Layout);
		jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel2Layout.createSequentialGroup().addGap(34, 34, 34).addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel2Layout.createSequentialGroup().addComponent(jLabel7).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(courseTeacherTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(45, 45, 45).addComponent(jLabel8).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(capacityTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(46, 46, 46).addComponent(jLabel9).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(numSelectedTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(jPanel2Layout.createSequentialGroup().addComponent(jLabel4).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(courseIdTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(45, 45, 45).addComponent(jLabel5).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(courseNameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(46, 46, 46).addComponent(jLabel6).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(courseTimeTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))).addContainerGap(149, Short.MAX_VALUE)));
		jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel2Layout.createSequentialGroup().addGap(19, 19, 19).addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(courseIdTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel4).addComponent(courseTimeTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel6).addComponent(courseNameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel5)).addGap(32, 32, 32).addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(courseTeacherTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel7).addComponent(numSelectedTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel9).addComponent(capacityTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel8)).addContainerGap(34, Short.MAX_VALUE)));
		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 920, Short.MAX_VALUE).addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))).addGroup(layout.createSequentialGroup().addGap(330, 330, 330).addComponent(jb_modify).addGap(50, 50, 50).addComponent(jb_delete).addGap(50, 50, 50).addComponent(jb_add))).addContainerGap()));
		layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(18, 18, 18).addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(27, 27, 27).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jb_delete).addComponent(jb_modify).addComponent(jb_add)).addContainerGap(36, Short.MAX_VALUE)));
		pack();
	}

	
	private void courseTableMousePressed(java.awt.event.MouseEvent evt) {
		// 获取选中的行
		row = courseTable.getSelectedRow();
		this.courseIdTxt.setText((String) courseTable.getValueAt(row, 0));
		this.courseNameTxt.setText((String) courseTable.getValueAt(row, 1));
		this.courseTimeTxt.setText((String) courseTable.getValueAt(row, 2));
		this.courseLocationTxt.setText((String) courseTable.getValueAt(row, 3));
		this.courseTeacherTxt.setText((String) courseTable.getValueAt(row, 4));
		this.capacityTxt.setText(String.valueOf((int) courseTable.getValueAt(row, 5)));
		this.numSelectedTxt.setText(String.valueOf((int) courseTable.getValueAt(row, 6)));
		NumSelected = (int) courseTable.getValueAt(row, 6);
	}

	
	public void SearchActionPerformed(ActionEvent evt) throws IOException, ClassNotFoundException {
		
		String s_courseName = this.s_courseNameTxt.getText();
		String s_courseTime = this.s_courseTeacherTxt.getText();
		String s_courseTeacher = this.s_courseLocationTxt.getText();
		MyCourseTime c= new MyCourseTime();
		String time =c.toEnglish(s_courseTime);
		System.out.println(s_courseTime);
		System.out.println(time);
		Socket socket = new Socket(IP(), 2000);//此处主机地址请自行修改
		//设置超时时间
		socket.setSoTimeout(3000);
		//构建IO
		OutputStream os = socket.getOutputStream();
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
		bw.write("48"+'\n'+s_courseName+'\n'+time+'\n'+s_courseTeacher+'\n');
		bw.flush();
		//从服务端输入到本地
		System.out.println("开始传输");
		InputStream is = socket.getInputStream();
		ObjectInputStream in = new ObjectInputStream(is);
		Object obj = in.readObject();
		list = (ArrayList<Course>) obj;
		System.out.println(list);
		//输出输入流关闭
		is.close();
		os.close();
		socket.close();
		System.out.println("传输结束");
		fillTable(list);

	}
	
	//修改课程信息
    public void ModifyActionPerformed(ActionEvent evt) throws IOException, ClassNotFoundException {
		//Course course=new Course(courseIdTxt.getText(),courseNameTxt.getText(),courseTimeTxt.getText(),8,courseTeacherTxt.getText(),courseLocationTxt.getText());
		String time=courseTimeTxt.getText();
		MyCourseTime c=new MyCourseTime();
		String cW=c.toEnglish(String.valueOf(time.charAt(1)));
		cW="周"+cW;
		char a1=time.charAt(3);
		char a2=time.charAt(5);
		char a3=time.charAt(6);
		int a=a1-'0';
		int b=0;
		if(a2>a3)  b=(a2-'0')*10+a3-'0';
		else b=a2-'0';
		System.out.println(a+" "+b);
		String courseId=courseIdTxt.getText();
		String courseName=courseNameTxt.getText();
		String cB= String.valueOf(a);
		String cE= String.valueOf(b);
		String courseTeacher=courseTeacherTxt.getText();
		String courseLocation=courseLocationTxt.getText();
		String courseCapacity=capacityTxt.getText();
		String courseSelected=numSelectedTxt.getText();
		System.out.println(cB+" "+cE);
		System.out.println("开始传输");
		//拉取选课队列
		Socket socket = new Socket(IP(), 2000);//此处主机地址请自行修改
		//设置超时时间
		socket.setSoTimeout(3000);
		//构建IO
		OutputStream os = socket.getOutputStream();
		InputStream is = socket.getInputStream();
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
		BufferedReader br = new BufferedReader(new InputStreamReader(is));
		//传输请求业务+学生id
		bw.write("40" + '\n'+courseId+'\n'+courseName+'\n'+cW+'\n'+cB+'\n'+cE+'\n'+courseTeacher+'\n'+courseLocation+'\n'+courseCapacity+'\n'+courseSelected+'\n');
		bw.flush();
		//从服务端输入到本地
		String str= br.readLine();
		System.out.println(str);
		System.out.println("传输结束");
		//输出输入流关闭
		os.close();
		socket.close();
		if (str.equals("true")) {
			JOptionPane.showMessageDialog(this, "修改成功!");
			list.remove(row);
			reFresh();
			this.fillTable(list);
		} else {
			JOptionPane.showMessageDialog(this, "修改失败!");
		}
	}

	
    //删除课程
    public void DeleteActionPerformed(ActionEvent evt) {
    	String courseId = this.courseIdTxt.getText();
		if (StringUtil.isEmpty(courseId)) {
			JOptionPane.showMessageDialog(this, "请选择要删除的记录!");
			return;
		}
		if (NumSelected > 0) {
			JOptionPane.showMessageDialog(this, "本课程已有人选,不能删除!");
			return;
		}
		int n = JOptionPane.showConfirmDialog(this, "确定要删除这条记录吗?");
		
		if (n == 0) {
			try {
				System.out.println("开始传输");
				//拉取选课队列
				Socket socket = new Socket(IP(), 2000);//此处主机地址请自行修改
				//设置超时时间
				socket.setSoTimeout(3000);
				//构建IO
				OutputStream os = socket.getOutputStream();
				InputStream is = socket.getInputStream();
				BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
				BufferedReader br = new BufferedReader(new InputStreamReader(is));
				//传输请求业务+学生id
				System.out.println(courseId);
				bw.write("45" + '\n'+courseIdTxt.getText()+'\n');
				bw.flush();
				//从服务端输入到本地
				String str= br.readLine();
				System.out.println(str);
				System.out.println("传输结束");
				//输出输入流关闭
				os.close();
				socket.close();
				if (str.equals("true")) {
					JOptionPane.showMessageDialog(this, "删除成功!");
					list.remove(row);
					this.fillTable(list);
				} else {
					JOptionPane.showMessageDialog(this, "删除失败!");
				}
			} catch (Exception e) {
				e.printStackTrace();
				JOptionPane.showMessageDialog(this, "删除失败!");
			}
			}
		}


	public void AddActionPerformed(ActionEvent evt) throws IOException, ClassNotFoundException {
		CourseAddFrame frame=new CourseAddFrame();
		frame.setVisible(true);
		frame.addWindowListener(new WindowListener() {
			@Override
			public void windowOpened(WindowEvent e) {

			}

			@Override
			public void windowClosing(WindowEvent e) {

			}

			@Override
			public void windowClosed(WindowEvent e) {
				try {
					reFresh();
				} catch (IOException ex) {
					throw new RuntimeException(ex);
				} catch (ClassNotFoundException ex) {
					throw new RuntimeException(ex);
				}
				fillTable(list);
			}

			@Override
			public void windowIconified(WindowEvent e) {

			}

			@Override
			public void windowDeiconified(WindowEvent e) {

			}

			@Override
			public void windowActivated(WindowEvent e) {

			}

			@Override
			public void windowDeactivated(WindowEvent e) {

			}
		});


	}

	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					new CourseMainViewFrame_Admin().setVisible(true);
				} catch (IOException e) {
					throw new RuntimeException(e);
				} catch (ClassNotFoundException e) {
					throw new RuntimeException(e);
				}
			}
		});
	}	
			
	
}

